{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "7191a600-140e-43c1-b27a-2f3b3a1b96fe",
   "metadata": {},
   "source": [
    "# 第二次作业\n",
    "\n",
    "## 学号32209700015"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "934904f3-87ac-45f3-a364-6a264cf72780",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "55\n"
     ]
    }
   ],
   "source": [
    "print(1+2+3+4+5+6+7+8+9+10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "aa1c58dc-4a03-481a-88a0-2d2563bc0310",
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      "请输入半径： 6\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "得到圆周长 37.68\n"
     ]
    }
   ],
   "source": [
    "r =input(\"请输入半径：\")\n",
    "r =eval(r)\n",
    "\n",
    "print(\"得到圆周长\" , 2*3.14*r)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "27744ceb-c9bb-49df-985a-f2c2195c647e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'str'>\n"
     ]
    }
   ],
   "source": [
    "print(type(r))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b3d5db05-ae02-4396-9b1a-7cadc1f4d1a9",
   "metadata": {},
   "source": [
    "# git的基本操作\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6e9018f9-2475-4b85-a548-611aaa8c8e85",
   "metadata": {},
   "source": [
    "### git版本控制软件，用来保存程序代码的工具。同时保存多个版本\n",
    "# clone\n",
    "### git clone<仓库名>\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3faba076-25eb-440d-8611-0fa4f0359680",
   "metadata": {},
   "source": [
    "## 每一次交作业的过程\n",
    "\n",
    "- git status\n",
    "- git add 文件\n",
    "- git commit-m\"name\"\n",
    "- git push"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f7e0dc4a-0f42-40b4-a605-7618fe4761a8",
   "metadata": {},
   "source": [
    "# 程序执行过程\n",
    "\n",
    "## 顺序执行\n",
    "\n",
    "## 循环执行\n",
    "\n",
    "## 分支（判断）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "298a8f15-ef0b-4543-a67e-2458c62dae10",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2 1\n"
     ]
    }
   ],
   "source": [
    "a = 1\n",
    "b = 2\n",
    "a = a+b\n",
    "b =a-b\n",
    "a =a-b\n",
    "print (a,b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "7d90a038-481c-4a4e-8949-670f48b89f6f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3\n"
     ]
    }
   ],
   "source": [
    "a = 1\n",
    "b = 2\n",
    "c = a+b\n",
    "b = 3\n",
    "print(c)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "30139088-cff1-489b-a9eb-e6c5f9f6cf99",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 0\n",
      "3 1\n",
      "6 2\n",
      "10 3\n",
      "15 4\n",
      "21 5\n",
      "28 6\n",
      "36 7\n",
      "45 8\n",
      "55 9\n",
      "55\n"
     ]
    }
   ],
   "source": [
    "s =0\n",
    "for i in range(10):\n",
    "    s =s + (i+ 1)\n",
    "    print(s,i)\n",
    "print(s)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "a60b3c18-817b-4936-8ae9-41b325eb5e9d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5050\n"
     ]
    }
   ],
   "source": [
    "s =0\n",
    "for i in range(100):\n",
    "    s =s + (i+ 1)\n",
    "    \n",
    "print(s)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b16a6755-d3f1-4d08-a58f-06cf637f97bb",
   "metadata": {},
   "source": [
    "## 计算100内奇数加和与偶数加和"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "2169140e-bae8-4fa4-b1e0-e17b7e4049da",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "偶数加起来为 2550\n"
     ]
    }
   ],
   "source": [
    "s =0\n",
    "for i in range(0,101,2):\n",
    "    s =s + i\n",
    "    \n",
    "print(\"偶数加起来为\" , s)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "7bbdab11-83cc-4713-8084-138098cd4022",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "奇数加起来为 2500\n"
     ]
    }
   ],
   "source": [
    "s =0\n",
    "for i in range(1,100,2):\n",
    "    s =s + i\n",
    "    \n",
    "print(\"奇数加起来为\" , s)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8f225d01-a428-43da-b9ac-dd44aa1a2409",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:base] *",
   "language": "python",
   "name": "conda-base-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
